
// MemMapViewView.h : interface of the CMemMapViewView class
//


#pragma once

struct MemoryBuffer : MEMORY_BASIC_INFORMATION {
	TCHAR szModule[MAX_MODULE_NAME32 + 1];
};

class CMemMapViewView : public CView
{
protected: // create from serialization only
	CMemMapViewView();
	DECLARE_DYNCREATE(CMemMapViewView)

// Attributes
public:
	CMemMapViewDoc* GetDocument() const;

// Operations
public:

// Overrides
public:
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
	bool m_IsWow;

// Implementation
public:
	virtual ~CMemMapViewView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:
	CAtlMap<int, MemoryBuffer> m_MemoryInfo;

	void UpdateList();

	void FormatAddress(CString& addr, PVOID p);

	class CMemMapList : public CMFCListCtrl {
		CMemMapViewView* m_pView;
	public:
		CMemMapList(CMemMapViewView* pView) : m_pView(pView) { }

		virtual int OnCompareItems(LPARAM p1, LPARAM p2, int col);
	};
	CMemMapList m_List;
	DWORD_PTR m_MemSelected;

// Generated message map functions
protected:
	afx_msg void OnFilePrintPreview();
	afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
	DECLARE_MESSAGE_MAP()
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg void OnSize(UINT nType, int cx, int cy);
	virtual void OnUpdate(CView* /*pSender*/, LPARAM /*lHint*/, CObject* /*pHint*/);
	void OnListItemChanged(NMHDR* pnmh, LRESULT* presult);
	afx_msg void OnSetFocus(CWnd* pOldWnd);
	void OnMemorySelection(CCmdUI* pCmdUI);
};

#ifndef _DEBUG  // debug version in MemMapViewView.cpp
inline CMemMapViewDoc* CMemMapViewView::GetDocument() const
   { return reinterpret_cast<CMemMapViewDoc*>(m_pDocument); }
#endif

